package main

import (
	"demo/15/model"
	"fmt"
	"net/rpc/jsonrpc"
)

func main6() {
	client, err := jsonrpc.Dial("tcp", "127.0.0.1:8090")
	if err != nil {
		fmt.Println("与服务端建立连接出错")
		return
	}
	defer client.Close()

	user := new(model.UserDetail)
	client.Call("UserHandler.GetUserInfo", "golang", user)
	if err != nil {
		fmt.Println("获取用户信息出错")
		return
	}

	fmt.Printf("用户ID：%+v\n", user.Id)
	fmt.Printf("用户名：%+v\n", user.Username)
	fmt.Printf("用户昵称：%+v\n", user.Nickname)
}
